<template>
    <div class="app-container">
        <!-- <div class="content">
            <div>
                <div><span>非营运客车起第 </span><span style="color: #00bfff;">{{ dataList[0].value }}</span> 年年检一次 </div>
                <div style="margin-top: 20px;"><span>非营运客车起第 </span><span style="color: #00bfff;">{{ dataList[1].value }}</span> 年年检一次
                </div>
                <div style="margin-top: 20px;"> <span>非营运客车超过 </span><span style="color: #00bfff;">{{ dataList[2].value }}</span> 年每 <span
                        style="color: #00bfff;">{{ dataList[3].value }}</span> 年检一次</div>
                <div style="margin-top: 20px;"> <span>货车</span>每 <span style="color: #00bfff;">{{ dataList[4].value }}</span> 年检一次</div>
            </div>

            <div class="btn">
                <el-button size="mini" type="text" @click="handleUpdate()"
                    v-hasPermi="['vehicle:checkUp:edit']">修改</el-button>
            </div>
        </div> -->
        <el-table @selection-change="handleSelectionChange" fit v-loading="loading" border :data="list">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="序号" type="index" />
            <el-table-column label="规则" prop="value">
                <template slot-scope="scope">
                    <div><span>非营运客车第 </span><span style="color: #00bfff;">{{ dataList&&dataList.length!=0?dataList[0].value:'--' }}</span> 年年检一次 </div>
                    <div><span>非营运客车第 </span><span style="color: #00bfff;">{{ dataList&&dataList.length!=0?dataList[1].value:'--'  }}</span> 年年检一次</div>
                    <div> <span>非营运客车超过 </span><span style="color: #00bfff;">{{ dataList&&dataList.length!=0?dataList[2].value:'--' }}</span> 年每 <span style="color: #00bfff;">{{ dataList&&dataList.length!=0?dataList[3].value:'--' }}</span> 年年检一次</div>
                    <div> <span>货车</span>每 <span style="color: #00bfff;">{{ dataList&&dataList.length!=0?dataList[4].value:'--' }}</span> 年年检一次</div>
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
                <template slot-scope="scope">
                    <el-button  size="mini" type="text" 
                        @click="handleUpdate(scope.row)" v-hasPermi="['vehicle:inspectionRules:edit']">修改</el-button>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
    </div>
</template>
  
<script>
import { listRules } from "@/api/car/carRules.js";

import { userSelect, deptTreeSelect } from "@/api/system/user.js";

export default {
    name: "remind",
    dicts: ["sys_driver_type"],

    data() {
        return {
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            dataList: [],
            // 遮罩层
            loading: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                status: 1,
                licenseNum: undefined,
            },
            list:[{}],
            // 日期范围
            dateRange: [],
            userList: [],
            deptOptions: [],
        };
    },
    created() {
        this.getList();
        this.userSelect();
        this.getDeptTree();
    },
    methods: {
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map((item) => item.carYearCheckId);
            this.single = selection.length != 1;
            this.multiple = !selection.length;
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.$router.push("./addInspectionRules");
        },
        handleDetail(row) {
            this.$router.push("./addRecord?isInfo=true&id=" + row.carYearCheckId);
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const configId = row.carYearCheckId || this.ids;

            this.$modal
                .confirm('是否确认删除ID为"' + configId + '"的数据项？')
                .then(function () {
                    return delCarYearCheck(configId);
                })
                .then(() => {
                    this.getList();
                    this.$modal.msgSuccess("删除成功");
                })
                .catch(() => { });
        },
        handleAdd() {
            this.$router.push("./addRecord");
        },
        /** 查询部门下拉树结构 */
        getDeptTree() {
            deptTreeSelect().then((response) => {
                this.deptOptions = response.data;
            });
        },
        userSelect() {
            userSelect().then((response) => {
                this.userList = response.data;
            });
        },
        /** 查询列表 */
        getList() {
            this.loading = true;
            listRules(
            ).then((response) => {
                this.dataList = response.data;
                // this.total = response.total;
                this.loading = false;
            });
        },

        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.dateRange = [];
            this.resetForm("queryForm");
            this.handleQuery();
        },
    },
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
    img {
        width: 100%;
    }
}

.content {
    border: 1px solid #f1f1f1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
</style>
  